package com.mao.strategypattern;

public class Main {

    public static void main(String[] args) {
        Order order = new Order();
        order.setAmount(10.5f);
        order.setOrderId("123456");

//        System.out.println("使用微信支付");
//        WechatPayService wechatPayService = new WechatPayService();
//        PayContext context = new PayContext(wechatPayService);
//        context.getStrategy().pay(order);
//
//        System.out.println("使用支付宝支付");
//        AliPayService aliPayService = new AliPayService();
//        PayContext payContext = new PayContext(aliPayService);
//        payContext.getStrategy().pay(order);

        PayContextFactory factory = new PayContextFactory();
        Strategy payMethod = factory.getPayMethod(PayContextFactory.PayMethod.ALIPAY);
        payMethod.pay(order);


    }

}
